/*
 * @Author: FengShan
 * @Date: 2025-07-07 17:11:50
 * @LastEditors: fengshan525 2735332396@qq.com
 * @LastEditTime: 2025-09-17 20:07:44
 * @Description: 有意向的客户/咨询的客户
 * 
 * Copyright (c) 2025 by FengShan, All Rights Reserved. 
 */

import { Controller, Get, Post, Body, Patch, Param, Delete, Query, Req } from '@nestjs/common';
import { AttemptCustomerService } from './attempt-customer.service';
import { AttemptCustomer } from '@libs/db/models/attempt.model';
import { IPaginationFormWithCondition } from 'types/requestParams';
import { Public } from 'src/decorations/public.decorator';
import { IpAddress } from 'src/decorations/IpAddress.decorations';

@Controller('attempt-customer')
export class AttemptCustomerController {
  constructor(private readonly attemptCustomerService: AttemptCustomerService) { }

  @Public()
  @Post('create')
  create(@Body() body: any, @IpAddress() clientIp: string) {
    console.log('数据',body);
    
    return this.attemptCustomerService.create(body, clientIp);
  }

  @Public()
  @Post('find')
  findToday(@Body() body: IPaginationFormWithCondition) {
    return this.attemptCustomerService.findToday(body);
  }

  @Public()
  @Post('findAll')
  findAll(@Body() body: IPaginationFormWithCondition) {
    return this.attemptCustomerService.findAll(body);
  }


  @Public()
  @Post('update')
  update(@Body() body: AttemptCustomer) {
    
    return this.attemptCustomerService.update(body);
  }

  @Public()
  @Get('delete')
  remove(@Query() req) {
    return this.attemptCustomerService.remove(req.id);
  }
}
